/*******************************************************************************
 * Copyright (c) 2012 Clever Devices.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 * 	Clever Devices Interns - 
 * 	Alex Frankel, Andria Young, Kevin Thomas, Nicholas Culpepper, Taner Oztimurlenk, Thomas Volberg
 ******************************************************************************/
package com.framework.customerservice;

import java.util.ArrayList;

import com.framework.cleverstop_tentative.R;
import com.framework.menu.MenuAdapter;
import com.framework.menu.MenuItem;
import com.slidingmenu.lib.SlidingMenu;
import com.slidingmenu.lib.app.SlidingActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

/**
 * This was simply the Contact Us page, which we were unable to finish.
 * When completed this page would feature all of the possible contact information for
 * both the TA and potentially us.
 * Each of the listed manners of contact would include a link to that website, email, phone call, etc.
 * This would be linked by clicking on each respective form of contact.
 * This was where you ended up when you selected "Contact Us" from the Customer Service Menu.
 * 
 * @author NCulpepper
 *
 */

public class ContactUs extends SlidingActivity implements OnItemClickListener {

	TextView display;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_contactus);
		setSlidingMenu();
		display = (TextView) findViewById(R.id.tvContactUs);
		
		Drawable d = this.getResources().getDrawable(R.drawable.layout_background);
		getActionBar().setBackgroundDrawable(d);
		getActionBar().setHomeButtonEnabled(true);
	}

	@Override
	public void onItemClick(AdapterView<?> parent, View view, int index, long id) {
		// TODO Auto-generated method stub
		switch (index) {

		// this is where each intent will be started for all of your
		// respective sections. Look to the "BUSTIME" case as a model
		case REWARDS:
			Intent Rewards = new Intent("com.framework.rewards.REWARDS");
			startActivity(Rewards);
			break;
		case BOARDS:
			Intent Customer = new Intent(
					"com.framework.customerservice.CUSTOMER");
			startActivity(Customer);
			break;
		case FARES:
			Intent Fares = new Intent(
					"com.framework.cleverstop_tentative.FARESMAINACTIVITY");
			startActivity(Fares);
			break;
		case BUSTIME:
			Intent BusTime = new Intent(
					"com.framework.cleverstop_tentative.BUSTIMEMAINACTIVITY");
			startActivity(BusTime);
			break;
		}
	}

	ListView mainList;
	MenuAdapter listData;
	ListAdapter realListData;
	Button test;

	public final int REWARDS = 0;
	public final int BOARDS = 1;
	public final int FARES = 2;
	public final int BUSTIME = 3;

	/**
	 * Sets up properties for the sliding menu this will keep properties
	 * consistent across all activities
	 */
	public void setSlidingMenu() {
		// sets view that slides out from left, this will be standard across all
		// menus
		// allowing for quick and intuitive navigation
		setBehindContentView(R.layout.persistent_menu_list);

		MenuItem[] menuItems = {
				new MenuItem("Rewards", R.drawable.rewaredsicon, "1"),
				new MenuItem("Boards", R.drawable.boardsicon, ""),
				new MenuItem("Fares", R.drawable.faresicon, ""),
				new MenuItem("BusTime", R.drawable.bustimeicon, ""),
				new MenuItem("Settings", R.drawable.settinsicon, "") };

		ArrayList<MenuItem> items = new ArrayList<MenuItem>();
		for (int i = 0; i < menuItems.length; i++)
			items.add(menuItems[i]);

		listData = new MenuAdapter(this, R.layout.listview_item_row, items);

		mainList = (ListView) findViewById(R.id.menuList);

		// dynamically add items to listView
		// did below as a test, but can easily add items based on the section of
		// app you are in
		// listData.insert("BusTime", list.size());

		mainList.setAdapter(listData);
		mainList.setOnItemClickListener(this);

		getSlidingMenu().setBehindOffsetRes(R.dimen.DistanceFromSide);
		getSlidingMenu().setBehindScrollScale(0.5f);
		getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
		getSlidingMenu().setActivated(true);

	}
}
